package com.sapient.logic;

import java.sql.SQLException;

import com.sapient.DAO.LoginDAO;

public class Authenticate {
	
	String role;
	LoginDAO loginDAOobj = new LoginDAO();
	
	public String getUserRole(String user){
		role=loginDAOobj.getUserRole(user);
		return role;
		
	}
	
	public int authenticateDetails(String username, String password) 
	
	{
		
		String pass=null;
		try {
			pass = loginDAOobj.userValidate(username);
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		if(pass!=null)
		{
			 if(pass.equals(password))
				{
					return 1;
				}
			 else
				 return -1;
			
		}
	
		else
			return 0;
		
	}

}
